package com.ruoyi.deviceControl.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; //添加
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.xuehua.SnowflakeIdUtils;
import com.ruoyi.deviceControl.domain.DeviceControl;
import com.ruoyi.deviceControl.mapper.DeviceControlMapper;
import com.ruoyi.deviceControl.service.IDeviceControlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 设备控制Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-14
 */
@Service
public class DeviceControlServiceImpl extends ServiceImpl<DeviceControlMapper, DeviceControl> implements IDeviceControlService //修改
{
    @Autowired
    private DeviceControlMapper deviceControlMapper;

    /**
     * 查询设备控制
     * 
     * @param deviceControlId 设备控制主键
     * @return 设备控制
     */
    @Override
    public DeviceControl selectDeviceControlByDeviceControlId(String deviceControlId)
    {
        return deviceControlMapper.selectDeviceControlByDeviceControlId(deviceControlId);
    }

    /**
     * 查询设备控制列表
     * 
     * @param deviceControl 设备控制
     * @return 设备控制
     */
    @Override
    public List<DeviceControl> selectDeviceControlList(DeviceControl deviceControl)
    {
        return deviceControlMapper.selectDeviceControlList(deviceControl);
    }

    /**
     * 新增设备控制
     * 
     * @param deviceControl 设备控制
     * @return 结果
     */
    @Override
    public int insertDeviceControl(DeviceControl deviceControl)
    {
        deviceControl.setDeviceControlId(String.valueOf(new SnowflakeIdUtils(5,8).nextId()));
        deviceControl.setCreateTime(DateUtils.getNowDate());
        return deviceControlMapper.insertDeviceControl(deviceControl);
    }

    /**
     * 修改设备控制
     * 
     * @param deviceControl 设备控制
     * @return 结果
     */
    @Override
    public int updateDeviceControl(DeviceControl deviceControl)
    {
        deviceControl.setUpdateTime(DateUtils.getNowDate());
        return deviceControlMapper.updateDeviceControl(deviceControl);
    }

    /**
     * 批量删除设备控制
     * 
     * @param deviceControlIds 需要删除的设备控制主键
     * @return 结果
     */
    @Override
    public int deleteDeviceControlByDeviceControlIds(String[] deviceControlIds)
    {
        return deviceControlMapper.deleteDeviceControlByDeviceControlIds(deviceControlIds);
    }

    /**
     * 删除设备控制信息
     * 
     * @param deviceControlId 设备控制主键
     * @return 结果
     */
    @Override
    public int deleteDeviceControlByDeviceControlId(String deviceControlId)
    {
        return deviceControlMapper.deleteDeviceControlByDeviceControlId(deviceControlId);
    }
}
